package thread;

public class Demo04CurrentThread {
    public static void main(String[] args) {
        //currentThread（）;获取当前的执行线程；
        //1.主线程: Thread[main,5,main]；线程名称，线程优先级，线程组
        Thread main=Thread.currentThread();
        System.out.println("主线程: "+main);
        //2.调用dosome（）方法:Thread[main,5,main]
        doSome();
        //3.自定义线程
        Thread t=new Thread(){
            public void run(){
                Thread t=Thread.currentThread();
                System.out.println("自定义线程：" + t);
                doSome();
            }
        };
        t.start();
    }

    public static void doSome() {
        Thread t = Thread.currentThread();
        System.out.println("正在执行dosome()方法的线程是" + t);
    }
}
